Skip to content

Delete some GDB debugvis cruft#154195

Closed
clarfonthey wants to merge 1 commit intorust-lang:mainfrom
clarfonthey:gdb-cruft
Closed

Delete some GDB debugvis cruft#154195
clarfonthey wants to merge 1 commit intorust-lang:mainfrom
clarfonthey:gdb-cruft

Conversation

@clarfonthey
Copy link
Copy Markdown
Contributor

Based upon discussion on Zulip: #t-compiler/debuginfo > GDB debugvis cruft

This ensures that ruff check passes, which will verify that it works on Python 3.9 (lowest valid version for Ruff to check). It removes:

  • old HashMap/HashSet stuff (rust-gdb is managed by rustup now)
  • Python 2 support (EOL, not really verifiable anyway)
  • GDB <7.12 support (this is 10 years old)

It also replaces the glob imports with ones that ruff check will be able to verify.

I would like to do more refactoring here and potentially split apart the visualisers across the various libstd crates (core, alloc, and std) but that is a larger change that this one, and this is mostly just to get verification on the changes being acceptable.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 22, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Mark-Simulacrum

Comment on lines -5 to -7
if version_info[0] >= 3:
xrange = range

Copy link
Copy Markdown
Contributor Author

@clarfonthey clarfonthey Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes Python 2 support, which was probably broken anyway. Not really possible to say.

Comment on lines -36 to -57
class EnumProvider(printer_base):
def __init__(self, valobj):
content = valobj[valobj.type.fields()[0]]
fields = content.type.fields()
self._empty = len(fields) == 0
if not self._empty:
if len(fields) == 1:
discriminant = 0
else:
discriminant = int(content[fields[0]]) + 1
self._active_variant = content[fields[discriminant]]
self._name = fields[discriminant].name
self._full_name = "{}::{}".format(valobj.type.name, self._name)
else:
self._full_name = valobj.type.name

def to_string(self):
return self._full_name

def children(self):
if not self._empty:
yield self._name, self._active_variant
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in other file, but this is older GDB support.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
PR_CI_JOB set; skipping tidy
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-03-05/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---

---- [debuginfo-gdb] tests/debuginfo/pretty-std-collections.rs stdout ----
NOTE: compiletest thinks it is using GDB version 16003000

error: check directive(s) from `/checkout/tests/debuginfo/pretty-std-collections.rs` not found in debugger output. errors:
    (pretty-std-collections.rs:49) `$13 = HashSet(size=4) = {1, 2, 3, 4}`
the following subset of check directive(s) was found successfully:
    (pretty-std-collections.rs:11) `$1 = BTreeSet(size=15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}`
    (pretty-std-collections.rs:14) `$2 = BTreeSet(size=0)`
    (pretty-std-collections.rs:17) `$3 = BTreeMap(size=15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14}`
    (pretty-std-collections.rs:20) `$4 = BTreeMap(size=0)`
    (pretty-std-collections.rs:23) `$5 = BTreeMap(size=2) = {[false] = core::option::Option<bool>::None, [true] = core::option::Option<bool>::Some(true)}`
    (pretty-std-collections.rs:27) `$6 = BTreeMap(size=15) = {[0] = pretty_std_collections::MyLeafNode (0), [1] = pretty_std_collections::MyLeafNode (1), [2] = pretty_std_collections::MyLeafNode (2), [3] = pretty_std_collections::MyLeafNode (3), [4] = pretty_std_collections::MyLeafNode (4), [5] = pretty_std_collections::MyLeafNode (5), [6] = pretty_std_collections::MyLeafNode (6), [7] = pretty_std_collections::MyLeafNode (7), [8] = pretty_std_collections::MyLeafNode (8), [9] = pretty_std_collections::MyLeafNode (9), [10] = pretty_std_collections::MyLeafNode (10), [11] = pretty_std_collections::MyLeafNode (11), [12] = pretty_std_collections::MyLeafNode (12), [13] = pretty_std_collections::MyLeafNode (13), [14] = pretty_std_collections::MyLeafNode (14)}`
    (pretty-std-collections.rs:31) `$7 = BTreeMap(size=1) = {[()] = 1}`
    (pretty-std-collections.rs:34) `$8 = BTreeMap(size=1) = {[1] = ()}`
    (pretty-std-collections.rs:37) `$9 = BTreeMap(size=1) = {[()] = ()}`
    (pretty-std-collections.rs:40) `$10 = VecDeque(size=3) = {5, 3, 7}`
    (pretty-std-collections.rs:43) `$11 = VecDeque(size=7) = {2, 3, 4, 5, 6, 7, 8}`
    (pretty-std-collections.rs:46) `$12 = HashMap(size=4) = {[1] = 10, [2] = 20, [3] = 30, [4] = 40}`
status: exit status: 0
command: PYTHONPATH="/checkout/src/etc" "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/checkout/obj/build/aarch64-unknown-linux-gnu/test/debuginfo/pretty-std-collections.gdb/pretty-std-collections.debugger.script"
--- stdout -------------------------------
GNU gdb (Ubuntu 16.3-1ubuntu2) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Breakpoint 1 at 0x2e638: file /checkout/tests/debuginfo/pretty-std-collections.rs, line 147.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Breakpoint 1, pretty_std_collections::main () at /checkout/tests/debuginfo/pretty-std-collections.rs:147
147     zzz(); // #break
$1 = BTreeSet(size=15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
$2 = BTreeSet(size=0)
$3 = BTreeMap(size=15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14}
$4 = BTreeMap(size=0)
$5 = BTreeMap(size=2) = {[false] = core::option::Option<bool>::None, [true] = core::option::Option<bool>::Some(true)}
$6 = BTreeMap(size=15) = {[0] = pretty_std_collections::MyLeafNode (0), [1] = pretty_std_collections::MyLeafNode (1), [2] = pretty_std_collections::MyLeafNode (2), [3] = pretty_std_collections::MyLeafNode (3), [4] = pretty_std_collections::MyLeafNode (4), [5] = pretty_std_collections::MyLeafNode (5), [6] = pretty_std_collections::MyLeafNode (6), [7] = pretty_std_collections::MyLeafNode (7), [8] = pretty_std_collections::MyLeafNode (8), [9] = pretty_std_collections::MyLeafNode (9), [10] = pretty_std_collections::MyLeafNode (10), [11] = pretty_std_collections::MyLeafNode (11), [12] = pretty_std_collections::MyLeafNode (12), [13] = pretty_std_collections::MyLeafNode (13), [14] = pretty_std_collections::MyLeafNode (14)}
$7 = BTreeMap(size=1) = {[()] = 1}
$8 = BTreeMap(size=1) = {[1] = ()}
$9 = BTreeMap(size=1) = {[()] = ()}
$10 = VecDeque(size=3) = {5, 3, 7}
$11 = VecDeque(size=7) = {2, 3, 4, 5, 6, 7, 8}
$12 = HashMap(size=4) = {[1] = 10, [2] = 20, [3] = 30, [4] = 40}
$13 = std::collections::hash::set::HashSet<u64, core::hash::BuildHasherDefault<pretty_std_collections::SimpleHasher>, alloc::alloc::Global> {base: hashbrown::set::HashSet<u64, core::hash::BuildHasherDefault<pretty_std_collections::SimpleHasher>, alloc::alloc::Global> {map: hashbrown::map::HashMap<u64, (), core::hash::BuildHasherDefault<pretty_std_collections::SimpleHasher>, alloc::alloc::Global> {hash_builder: core::hash::BuildHasherDefault<pretty_std_collections::SimpleHasher> (core::marker::PhantomData<fn() -> pretty_std_collections::SimpleHasher>), table: hashbrown::raw::RawTable<(u64, ()), alloc::alloc::Global> {table: hashbrown::raw::RawTableInner {bucket_mask: 7, ctrl: core::ptr::non_null::NonNull<u8> {pointer: 0xaaaaaab022e0}, growth_left: 3, items: 4}, alloc: alloc::alloc::Global, marker: core::marker::PhantomData<(u64, ())>}}}}
A debugging session is active.

 Inferior 1 [process 233915] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
------------------------------------------
--- stderr -------------------------------
Python Exception <class 'gdb.error'>: There is no member named table.
Python Exception <class 'gdb.error'>: There is no member named table.
------------------------------------------

---- [debuginfo-gdb] tests/debuginfo/pretty-std-collections.rs stdout end ----

failures:

@clarfonthey
Copy link
Copy Markdown
Contributor Author

@rustbot author (since I still need to fix these issues)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 24, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 5, 2026

☔ The latest upstream changes (presumably #154824) made this pull request unmergeable. Please resolve the merge conflicts.

@clarfonthey
Copy link
Copy Markdown
Contributor Author

Gonna close this for now; there are merge conflicts and I think I want to do this a bit slower first.

@clarfonthey clarfonthey closed this Apr 7, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants